package com.zy.web.demo.duoxiancheng.demo20;

import java.io.IOException;
import java.io.PipedInputStream;

/**
 * @author <a href="mailto:zhouyong@cqyyt.com">zy</a>
 * @version 1.0
 * @date 2020/8/20 14:20
 */
public class ReadData {

    public void readMethod(PipedInputStream input){
        try {
            System.out.println("read :");
            byte[] bytes = new byte[20];
            int readline = input.read(bytes);
            while ( readline != -1 ){
                String newData = new String(bytes,0,readline);
                System.out.println("read"+newData);
                readline = input.read(bytes);
            }
            System.out.println();
            input.close();
        }catch (IOException e){
            e.printStackTrace();
        }
    }

}
